﻿using System;
using System.IO;
using System.Net;

namespace _062_从web服务器下载图片
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入图片的URL：");
            string 图片地址 = Console.ReadLine();

            HttpWebRequest 获取 = WebRequest.CreateHttp(图片地址);
            获取.Method = "GET";

            HttpWebResponse 请求 = (HttpWebResponse)获取.GetResponse();

            using (Stream 出来=请求.GetResponseStream())
            {

                //写入文件
                using (FileStream 来来来=new FileStream("down.jpg",FileMode.Create))
                {
                    出来.CopyTo(来来来);
                }
            }

        }
    }
}
